﻿using BCCServer.DAO.login;
using BCCServer.IService.ILoginService;
using BCCServer.Model.ModelsOut;
using BCCServer.Web.Filter;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace BCCServer.Web.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class LoginController : ControllerBase
    {
        private readonly ILogin ilogin;

        public LoginController(ILogin iloginDB)
        {
            this.ilogin = iloginDB;
        }

        [HttpGet]
        [Route("selLogin")]
        /// <summary>
        /// 根据账号密码查询信息并登录
        /// </summary>
        /// <param name="sendAccount"></param>
        /// <param name="receiveAccount"></param>
        /// <returns></returns>
        public BaseOut selLogin(string Account, string pwd)
        {
            try
            {
                //BCCServer.Service.LoginService.Login login=new BCCServer.Service.LoginService.Login(this.iloginDB);
                var rs = ilogin.selLogin(Account, pwd);
                return new BaseOut {code="true",content= rs };
            }
            catch (Exception)
            {
                return new BaseOut { code = "false", content = "查询失败" };
            }
        }
    }
}
